/* Copyright (c) 2007-2012, ben "boin" bonoeil */

#ifndef _HL2DEMO_BUFFER_H_
#define _HL2DEMO_BUFFER_H_

#include "externc.h"

typedef struct buffer_s * buffer_t;

EXTERN_C buffer_t buffer_create(int size);
EXTERN_C      int buffer_destroy(buffer_t buf, int force);

EXTERN_C buffer_t buffer_resize(buffer_t buf, int size);
EXTERN_C buffer_t buffer_ensure(buffer_t buf, int size);
EXTERN_C buffer_t buffer_ensure_free(buffer_t buf, int size);

EXTERN_C    void* buffer_lock(buffer_t buf, int * idx, int * len);
EXTERN_C      int buffer_unlock(void * data);

EXTERN_C     void buffer_reset(buffer_t buf);
EXTERN_C buffer_t buffer_append(buffer_t buf, const void * data, int len);

#endif  /* #ifndef _HL2DEMO_BUFFER_H_ */
